
var validateEmail = (rule, value, callback) => {
    if (!icu.util.jude(value, 'email')) {
        callback()
    } else {
        callback(new Error(icu.util.jude(value, 'email')));
    }
}
var validateMobile = (rule, value, callback) => {
    if (!icu.util.jude(value, 'phone')) {
        callback()
    } else {
        callback(new Error(icu.util.jude(value, 'phone')));
    }
}
var validatePassword = (rule, value, callback) => {
    if (/^(?![\d]+$)(?![a-zA-Z]+$)(?![^\da-zA-Z]+$).{8,16}$/.test(value)) {
        callback()
    } else {
        callback(new Error('请输入8-16位 密码强度调整为 英文大小写+数字+特殊字符'));
    }
}

let addconfig = {
    isShow: true,
    name: 'userAdd',
    labelWidth: 130,
    form: [
        { type: 'input', dataType: 'text', key: 'username', label: '用户名', icon: '', disabled: false, placeholder: '请输入', showwordlimit: true, maxlength: 100, default: '' },
        { type: 'treeSelect', key: 'deptId', label: '所属部门', data: [] },
        { type: 'input', dataType: 'password', key: 'password', label: '密码', icon: '', disabled: false, placeholder: '请输入8-16位 密码强度调整为 英文大小写+数字+特殊字符', showwordlimit: true, maxlength: 30, default: '' },
        { type: 'input', dataType: 'password', key: 'qrmm', label: '确认密码', icon: '', disabled: false, placeholder: '请输入', showwordlimit: true, maxlength: 30, default: '' },
        { type: 'input', dataType: 'text', key: 'realName', label: '真实姓名', icon: '', disabled: false, placeholder: '请输入', showwordlimit: true, maxlength: 10, default: '' },
        { type: 'input', dataType: 'text', key: 'email', label: '邮箱', icon: '', disabled: false, placeholder: '请输入', default: '' },
        { type: 'input', dataType: 'text', key: 'cardnumber', label: '身份证号', icon: '', disabled: false, placeholder: '请输入', default: '' },
        { type: 'input', dataType: 'text', key: 'mobile', label: '手机号', icon: '', disabled: false, placeholder: '请输入', default: '' },
        { type: 'slot', label: '角色配置', name: 'roleIds' },
        { type: 'radio', key: 'status', label: '状态', textAlign: 'left', default: 1, radioData: [{ lable: '停用', value: 0 }, { lable: '正常', value: 1 }], grid: { xl: 12, lg: 24, md: 24, sm: 24, xs: 24 }, },
        { type: 'radio', key: 'cutstation', label: '房产系统角色', textAlign: 'left', default: 0, radioData: [{ lable: '住建', value: 0 }, { lable: '银行', value: 1 }, { lable: '开发商', value: 2 }], grid: { xl: 12, lg: 24, md: 24, sm: 24, xs: 24 } },
        { type: 'slot', label: '头像', name: 'headerDocId' },
        { type: 'slot', label: '签名图片', name: 'signDocId' }
    ],
    rules: {
        deptId: [{ required: true, message: '请输入所属部门', trigger: 'change' }],
        // email: [
        //     { required: true, message: '请输入邮箱', trigger: 'blur' },
        //     { validator: validateEmail, trigger: 'blur' }],
        mobile: [
            { required: true, message: '请输入手机号', trigger: 'blur' },
            { validator: validateMobile, trigger: 'blur' }],
        realName: [{ required: true, message: '请输入真实姓名', trigger: 'blur' }],
        username: [{ required: true, message: '请输入用户', trigger: 'blur' }],
        password: [
            { required: true, message: '请输入密码', trigger: 'blur' },
            // { validator: validatePassword, trigger: 'blur' }
        ],
        qrmm: [{ required: true }]
    },
    grid: {
        xl: 24,
        lg: 24,
        md: 24,
        sm: 24,
        xs: 24
    },
    event: {
        iconInput: () => {
        }
    } // 动态绑定事件
}
let editconfig = {
    isShow: true,
    name: 'userUpdata',
    labelWidth: 120,
    form: [
        { type: 'input', dataType: 'text', key: 'username', label: '用户名', icon: '', disabled: true, placeholder: '请输入', showwordlimit: true, maxlength: 100, default: '' },
        { type: 'treeSelect', key: 'deptId', label: '所属部门', data: [] },
        { type: 'input', dataType: 'text', key: 'realName', label: '真实姓名', icon: '', disabled: false, placeholder: '请输入', showwordlimit: true, maxlength: 10, default: '' },
        { type: 'input', dataType: 'text', key: 'email', label: '邮箱', icon: '', disabled: false, placeholder: '请输入', default: '' },
        { type: 'input', dataType: 'text', key: 'cardnumber', label: '身份证号', icon: '', disabled: false, placeholder: '请输入', default: '' },
        { type: 'input', dataType: 'text', key: 'mobile', label: '手机号', icon: '', disabled: false, placeholder: '请输入', default: '' },
        { type: 'slot', label: '角色配置', name: 'roleIds' },
        { type: 'radio', key: 'status', label: '状态', textAlign: 'left', default: 1, radioData: [{ lable: '停用', value: 0 }, { lable: '正常', value: 1 }], grid: { xl: 12, lg: 24, md: 24, sm: 24, xs: 24 } },
        { type: 'radio', key: 'cutstation', label: '房产系统角色', textAlign: 'left', default: '0', radioData: [{ lable: '住建', value: '0' }, { lable: '银行', value: '1' }, { lable: '开发商', value: '2' }], grid: { xl: 12, lg: 24, md: 24, sm: 24, xs: 24 } },
        { type: 'slot', label: '头像', name: 'headerDocId' },
        { type: 'slot', label: '签名图片', name: 'signDocId' }
    ],
    rules: {
        realName: [{ required: true, message: '请输入真实姓名', trigger: 'change' }],
        username: [{ required: true, message: '请输入用户', trigger: 'change' }],
        deptId: [{ required: true, message: '请选择所属部门', trigger: 'change' }],
        // email: [
        //     { required: true, message: '请输入邮箱', trigger: 'change' },
        //     { validator: validateEmail, trigger: 'blur' }],
        mobile: [
            { required: true, message: '请输入手机号', trigger: 'change' },
            { validator: validateMobile, trigger: 'blur' }],
    },
    grid: {
        xl: 24,
        lg: 24,
        md: 24,
        sm: 24,
        xs: 24
    },
    event: {
        iconInput: () => {
        }
    } // 动态绑定事件
}
export { addconfig, editconfig }